# -*- coding: utf-8 -*-
import SendMessage as sm
import os
import time
import datetime
import logging


def get_FileCreateTime(filePath):
    filePath = unicode(filePath, 'utf8')
    t = os.path.getctime(filePath)
    return t

def getDaysBetweenCreateAndNow(filePath):
    create = datetime.datetime.fromtimestamp(get_FileCreateTime(filePath))
    now = datetime.datetime.now()
    return (now - create).days


if __name__ == "__main__":
    if os.path.exists(sm.biddingIdSendLogPath):
        days = getDaysBetweenCreateAndNow(sm.biddingIdSendLogPath)
        if days > 7:
            logging.info('deleting id file...')
            os.remove(sm.biddingIdSendLogPath)
            logging.info('delete done!')